﻿using ProjectManager.Interface;
using ProjectManager.Logic;
using ProjectManager.Logic.Content;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.VisualStyles;
using System.Xml.Linq;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace ProjectManager.Controller
{
    internal partial class LogicController : ILogic
    {
        private static string GetNameFromGitUrl(string url)
        {
            // 例如https://gitee.com/zhihao2023/project-manager.git
            string projectName = url.Split('/').Last();
            if (projectName.Contains('.'))
                projectName = projectName.Split(".")[0];
            return projectName;
        }
        
        private void CommitAndPush(string branchPath, string branchName, string commitName, string addContent)
        {
            gitController.Commit(branchPath, branchName
                , commitName, $"{CurrentIdentity.Name} {commitName} {addContent}");
            gitController.Push(branchPath, branchName);
        }
    }
}
